package pcb.models.vo 
{
	import flash.events.EventDispatcher;
	import flash.media.Sound;
	import pcb.models.events.ModelEvent;
	
	/**
	 * ...
	 * @author Fintan Boyle
	 */
	public class NarrativeVo extends EventDispatcher implements IAsset 
	{
		//-----------
		//unique properties of NarrativeVo		
		public var votext:String;
		
		private var _sound:Sound;
		//-----------
		
		private var _id:String;
		private var _ownerId:String;
		
		/**
		 * intended to hold the string form of 
		 * an asset type such as 'NarrativeVo'
		 */
		private var _type:String;
		private var _loaded:Boolean;
		private var _url:String;
		
		public function NarrativeVo(id:String, url:String="", votext:String="", loaded:Boolean=false) 
		{
			_id = id;
			_url = url;
			this.votext = votext;
			_type = "NarrativeVo";
			setLoaded(loaded);
		}
		
		/* INTERFACE pcb.models.vo.IAsset */
		
		public function getId():String
		{
			return _id;
		}
		
		public function setId(id:String):void
		{
			_id = id;
		}
		
		public function isLoaded():Boolean
		{
			return _loaded;
		}
		
		public function setLoaded(boo:Boolean):void
		{
			_loaded = boo;
			
			if (_loaded) {
				//trace("loaded is true for slide " + this.getId());
				var e:ModelEvent = new ModelEvent(ModelEvent.LOADED);
				e.id = this.getId();
				this.dispatchEvent(e);
			}
			
		}
		
		public function getAssetType():String
		{
			return _type
		}
		
		public function setAssetType(type:String):void
		{
			_type = type;
		}
		
		public function getUrl():String
		{
			return _url;
		}
		
		public function setUrl(url:String):void
		{
			_url = url;
		}
		
		public function getOwnerId():String
		{
			return _ownerId;
		}
		
		public function setOwnerId(id:String):void
		{
			_ownerId = id;
		}
		
		public function get sound():Sound { return _sound; }
		
		public function set sound(value:Sound):void 
		{			
			_sound = value;
			setLoaded(true);
		}
		
	}
	
}